|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectj3deditor.bin.util.XMLParser
public class XMLParser
Tool for loading and saving XML files.
| Constructor Summary | |
|---|---|
XMLParser()
Creates an instance of XMLParser. |
|
XMLParser(java.io.File file)
Creates an instance of XMLParser
and loads an XML file if possible. |
|
XMLParser(java.io.InputStream resource)
Creates an instance of XMLParser
and loads an XML file if possible. |
|
| Method Summary | |
|---|---|
org.w3c.dom.Node |
getAttribute(java.lang.String attribute,
org.w3c.dom.Node node)
Returns the requested attribute of the given node. |
org.w3c.dom.Node |
getRoot()
Returns the root element of the document tree. |
java.lang.String |
getRootAttribute(java.lang.String attribute)
Returns the requested attribute of the root node. |
java.lang.String[][] |
getTable()
Returns 2-dimensional array that contains the elements of the document tree. |
java.lang.String[][] |
getTable(java.lang.String node,
java.lang.String[] elements)
Returns 2-dimensional array that contains the specified descendants of the element named node. |
void |
saveFile(java.io.File file)
Saves the document tree to specified file. |
void |
setData(java.lang.String[][] data)
Creates the document tree from 2-dimensional array[m][n] where n equals 2. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XMLParser()
XMLParser.
public XMLParser(java.io.InputStream resource)
throws java.lang.Exception
XMLParser
and loads an XML file if possible.
resource - stream of the XML file that will be loaded
java.lang.Exception - if cannot load specified file
public XMLParser(java.io.File file)
throws java.lang.Exception
XMLParser
and loads an XML file if possible.
file - XML file that will be loaded
java.lang.Exception - if cannot load specified file| Method Detail |
|---|
public org.w3c.dom.Node getRoot()
public java.lang.String getRootAttribute(java.lang.String attribute)
attribute - the name of the attribute
public org.w3c.dom.Node getAttribute(java.lang.String attribute,
org.w3c.dom.Node node)
throws java.lang.Exception
attribute - the name of the attributenode - node which attribute is requested
java.lang.Exception - if unable to aquire the requested attribute
public java.lang.String[][] getTable()
throws java.lang.Exception
java.lang.Exception - if something bad happens
public java.lang.String[][] getTable(java.lang.String node,
java.lang.String[] elements)
throws java.lang.Exception
node.
node - name of the node which descendants are requiredelements - array of node names which are required
String array that
contains the elements of the document tree
java.lang.Exception - if something bad happens
public void setData(java.lang.String[][] data)
throws java.lang.Exception
data - 2-dimensional String array
java.lang.Exception - ArrayOutOfBoundsException if data has less than 2 columnspublic void saveFile(java.io.File file)
file - name of the file
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||